<template>
  <div>
    <el-table :data="list" style="width: 100%;padding-top: 15px;">
      <el-table-column label="药品名称">
        <!-- <template slot-scope="scope">
          {{ scope.row.order_no | orderNoFilter }}
        </template> -->
        <template slot-scope="scope">
          {{ scope.row.name }}
        </template>
      </el-table-column>
      <el-table-column label="药品库存" width="" align="center">
        <template slot-scope="scope">
          {{ scope.row.number }}
        </template>
      </el-table-column>
      <el-table-column label="数量状态" width="" align="center">
        <template slot-scope="scope">
          {{ scope.row.type }}
        </template>
      </el-table-column>
      <el-table-column label="报警上限" width="" align="center">
        <template slot-scope="scope">
          {{ scope.row.upperLimit }}
        </template>
      </el-table-column>
      <el-table-column label="报警下限" width="" align="center">
        <template slot-scope="scope">
          {{ scope.row.lowerLimit }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
// import { transactionList } from '@/api/remote-search'
import { getPayment } from '@/api/pay'
import { getLowerWarning, queryUpperWarning } from '@/api/medicine'

export default {
  data() {
    return {
      list: null
    }
  },
  created() {
    this.fetchData2()
  },
  methods: {
    async fetchData2() {
      const res1 = await getLowerWarning()
      const res2 = await queryUpperWarning()
      console.log(res1)
      if (!res1.data.list && !res1.data.list) {
        this.list = null
      }
      if (res1.data.list && !res1.data.list) {
        for (const i in res1.data.list) {
          res1.data.list[i].type = '跌破下限,需补充'
        }
        this.list = res1.data.list
      }
      if (!res1.data.list && res1.data.list) {
        for (const i in res2.data.list) {
          res1.data.list[i].type = '超出上限,数量太多'
        }
        this.list = res2.data.list
      } else {
        for (const i in res1.data.list) {
          res1.data.list[i].type = '跌破下限,需补充'
        }
        for (const i in res2.data.list) {
          res1.data.list[i].type = '超出上限,数量太多'
        }
        res1.data.list.push()
        console.log(res1.data.list)
        this.list = res1.data.list
      }
    }
  }
}
</script>
